﻿using FluentNHibernate.Mapping;
using YYSite.Domain.BaseData;
using YYSite.Domain.BaseData.SchoolYears;

namespace YYSite.Repository.BaseData.SchoolYears
{
    public class SchoolYearMap:ClassMap<SchoolYear>
    {
        public SchoolYearMap()
        {
            this.Table("SchoolYear");
            this.Schema(BaseDataConstant.Schema);
            this.Id(p => p.Id);
            this.Map(p => p.StudyYear).Not.Nullable().UniqueKey("SchoolYear_StudyYear_Semester");
            this.Map(p => p.Semester).Not.Nullable().UniqueKey("SchoolYear_StudyYear_Semester");
            this.Map(p => p.StudyStartDay);
            this.Map(p => p.StudyEndDay);
            this.Map(p => p.RecessStartDay);
            this.Map(p => p.RecessEndDay);
            this.Map(p => p.CreateTime).Default("GETDATE()").Not.Nullable();
        }
    }
}
